/**
 * Copyright (C), 2020, 安徽贝慕信息科技有限公司
 * FileName: AppDateilController
 * Author:   Allen
 * Date:     2020/8/26 11:06
 * Description: APPKey 生成密钥处理controller
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.bim.marvel.rest;

import com.bim.marvel.openapi.client.dto.AppDetailDTO;
import com.bim.marvel.openapi.client.query.PageQuery;
import com.bim.marvel.common.core.model.dto.SimplePageVO;
import com.bim.marvel.common.core.model.dto.SimpleVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 〈APPKey 生成密钥处理controller〉
 *
 * @author Allen
 * @date 2020/8/26
 * @since 1.0.0
 */
@Api(tags = {"开放平台密钥生成处理-controller"})
@RequestMapping("/api/app/dateil")
public interface AppDateilController {

    /**
     * 根据ID获得AppDateil实体信息请求URL
     */
    String GET_APP_DATEIL_URL = "/byId/{appId}";

    /**
     * 获得AppDateil实体列表请求URL
     */
    String LIST_APP_DATEIL_URL = "/list";

    /**
     * 根据ID更新AppDateil实体信息请求URL
     */
    String APP_DATEIL_UPDATE_URL = "/update";

    /**
     * 根据ID删除AppDateil实体信息请求URL
     */
    String APP_DATEIL_DELETE_URL = "/remove/{appId}";

    /**
     * 删除开放平台密钥信息
     * @param appId AppId信息
     * @return 是否操作成功标识
     */
    @ApiOperation(value = "删除开放平台密钥信息", notes = "删除开放平台密钥信息",
            protocols = "http,https", httpMethod = "POST")
    @PostMapping(value = APP_DATEIL_DELETE_URL, consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
            produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<Boolean> removeById(@PathVariable(value = "appId") String appId);

    /**
     * 更新开放平台Token信息
     * @param appId AppId信息
     * @param token token信息
     * @return 是否操作成功标识
     */
    @ApiOperation(value = "更新开放平台Token信息", notes = "更新开放平台Token信息",
            protocols = "http,https", httpMethod = "POST")
    @PostMapping(value = APP_DATEIL_UPDATE_URL, consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE},
            produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<AppDetailDTO> updateTokenById(@RequestParam("appId") String appId, @RequestParam("token") String token);

    /**
     * 获得开放平台密钥信息
     * @param appId 获得开放平台密钥信息
     * @return 开放平台密钥信息
     */
    @ApiOperation(value = "获得开放平台密钥信息", notes = "获得开放平台密钥信息",
            protocols = "http,https", httpMethod = "GET")
    @GetMapping(value = GET_APP_DATEIL_URL, produces = {MediaType.APPLICATION_JSON_VALUE})
    SimpleVO<AppDetailDTO> getAppDetail(@PathVariable(value = "appId") String appId);


    /**
     * 获得AppDateil实体列表
     * @param appId 查询入参appId
     * @param pageQuery 分页入参
     * @return AppDateil实体列表
     */
    @ApiOperation(value = "获得AppDateil实体列表", notes = "获得AppDateil实体列表",
            protocols = "http,https", httpMethod = "GET")
    @GetMapping(value = LIST_APP_DATEIL_URL, produces = {MediaType.APPLICATION_JSON_VALUE})
    SimplePageVO<List<AppDetailDTO>> listAppDetail(@RequestParam(value = "appId", required = false) String appId,
                                                    PageQuery pageQuery);

}
